package com.ruoyi.hr.service.impl;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.hr.controller.hr.CompanyController;
import com.ruoyi.hr.controller.hr.JinPengController;
import com.ruoyi.hr.domain.Authority;
import com.ruoyi.hr.domain.Companys;
import com.ruoyi.hr.domain.DictionaryTable;
import com.ruoyi.hr.mapper.CompanysMapper;
import com.ruoyi.hr.service.CompanysService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class CompanysServiceImpl implements CompanysService {
    @Autowired
    private CompanysMapper companysMapper;

    @Autowired
    private JinPengController jinPengController;

    @Autowired
    private CompanyController companyController;

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public List<String> findSubsidiaryID(List<String> AllID) {
        return companysMapper.findSubsidiaryID(AllID);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public List<Companys> findAllCompanys(Long compID) {
        return companysMapper.findAllCompanys(compID);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public List<Map<String, Object>> findAllTree(List<String> AllID) {
        return companysMapper.findAllTree(AllID);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public int findCount(Companys companys, List<Authority> authorities) {
        return companysMapper.findCount(companys, authorities);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public List<Companys> findPage(int PageNum, int PageSize, Companys companys, List<Authority> authorities) {
        return companysMapper.findPage((PageNum - 1) * PageSize, PageSize, companys, authorities);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public Companys findCompanys(Long compID) {
        return companysMapper.findCompanys(compID);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public int updateCompany(Companys companys) {
        return companysMapper.updateCompany(companys);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public int insertCompany(Companys companys) {
        return companysMapper.insertCompany(companys);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public Companys findDepIDComp(String depID) {
        return companysMapper.findDepIDComp(depID);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public int findCompCount() {
        return companysMapper.findCompCount();
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public List<DictionaryTable> findCompGroup() {
        return companysMapper.findCompGroup();
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public List<DictionaryTable> findCompGrade() {
        return companysMapper.findCompGrade();
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public List<Companys> findExport(Companys companys, List<Authority> authorities) {
        return companysMapper.findExport(companys,authorities);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public List<Companys> findAllByAuthority(Companys companys,Authority authority) {
        return companysMapper.findAllByAuthority(companys,authority);
    }
}
